<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        window.onload=function(){
          var oTxt1=document.getElementById('txt1');
          var oTxt2=document.getElementById('txt2');
          var oBtn=document.getElementById('btn1');
          oBtn.onclick=function(){
            var re=/北京|百度|淘宝/g;// |表示或的意思  g(全部)非常重要，写的时候不要忘记
              oTxt2.value=oTxt1.value.replace(re,'***');
          };
        };
    </script>
</head>
<body>
<textarea name="" id="txt1" cols="30" rows="10"></textarea><br>
<input id="btn1" type="button" value="过滤"><br>
<textarea name="" id="txt2" cols="30" rows="10"></textarea>
</body>
</html>